//
//  EventBrief.swift
//  youpeng
//
//  Created by 邓书哲 on 2022/12/10.
//

import Foundation
//什么样的数据结构才遵从Codable？
//数据结构中的每一个数据都是Codable的


/// EventDetail
// MARK: - EventDetail
struct EventDetail: Codable {
    let eventBrief: EventBrief
    /// 报名者
    let applicants: [UserBrief]
    /// 是否需要审核
    let check: Bool
    /// 评论
    let commentCount: Int
    /// 报名表
    let entryForm: [String]?
    /// 活动图片，最多上传9张
    let images: [String]
    /// 是否需要报名表
    let isEntryForm: Bool
    /// 是否允许中途加入
    let joinHalfway: Bool
    /// 活动地点
    let location: String
    /// 活动详情
    let description: String
}


/// EventTable
// MARK: - EventTable
struct EventTable: Codable {
    /// 活动类别
    var category: EventCategory
    /// 活动详情
    var description: String
    /// 报名表
    var entryForm: [String]?
    /// 活动时间
    var eventTime: EventTime
    /// 活动图片/海报，最多上传9张，默认第一张为还封面海报
    var images: [String]
    /// 是否需要审核
    var isCheck: Bool
    /// 是否需要报名表
    var isEntryForm: Bool
    /// 是否允许中途加入
    var joinHalfway: Bool
    /// 活动地点
    var location: String
    /// 活动限制人数
    var quota: Int
    /// 活动主题
    var title: String
}



/// EventBrief
// MARK: - EventBrief
struct EventBrief: Codable {
    /// 活动类别
    let category: EventCategory
    /// 活动封面
    let cover: String
    /// 活动唯一标识，不可重复
    let eventId: Int
    /// 活动时间
    let eventTime: EventTime
    /// 活动收藏数
    let favoriteCount: Int
    /// 活动组织者
    let host: UserBrief
    /// 活动点赞数
    let likeCount: Int
    /// 活动参加人数
    let participantCount: Int
    /// 活动限制人数
    let quota: Int
    /// 活动状态
    let status: EventStatus
    /// 活动主题
    let title: String
}


//后端到底传什么过来？String?还是Integer?最好是String，这样见名思意
enum EventStatus: String, Codable {
    case ongoing = "ongoing"
    case enrolling = "enrolling"
    case end = "end"
    case full = "full"
}

enum EventCategory: String, Codable {
    case association = "association"
    case contest = "contest"
    case academic = "academic"
    case sport = "sport"
    case salon = "salon"
    case literatureAndArt = "literatureAndArt"
}

/// 一级导航栏
enum FirstNavigation: Int, Codable {
    case compus = 100
    case explore = 200
    case follow = 300
}

enum SecondNavigation: Int, Codable {
    case rank = 101
    case newest = 102
    case association = 103
    case contest = 104
    case academic = 105
    case sport = 106
    case salon = 107
    case literatureAndArt = 108
}

/// 活动时间
///
/// EventTime
// MARK: - EventTime
struct EventTime: Codable {
    /// 结束日期
    var endDate: String
    /// 结束时间
    var endTime: String?
    /// 开始日期
    var startDate: String
    /// 开始时间
    var startTime: String?
}


